/**
 * @author hexj
 * @desc 用户浏览记录
 * @time 2018-07-12
 */
const app = getApp();
Component({
  properties: {
    list: {
      type: Array,
      value: []
    }
  },
  data: {},
  methods: {
    actionTap(event) {
      let {
          id,
          employeeid,
          type,
          userid,
          orgid
        } = event.currentTarget.dataset,
        webViewQuery = encodeURIComponent(`shareEmployeeId=${userid}`),
        path = '';
      const webViewUrl = '/pages/WebView/webView?url=user&webHash=';
      switch (type) {
        case '33': //浏览微名片
        case '34':
          {
            path = `/pages/User/Vcard/vcard2?employeeId=${employeeid}&orgId=${orgid}&shareUserId=${userid}`;
            xhs.navigateTo({
              url: path
            });
          }
          break;
        case '4': //报名活动
        case '21':
          {
            path = `/pages/User/Activity/Info/info?id=${id}&shareUserId=${userid}`;
            xhs.navigateTo({
              url: path
            });
          }
          break;
        case '5': //拼团
        case '22':
          {
            path = `/independentCollage/Collage/Detail/detail?id=${id}&userId=${userid}&shareUserId=${userid}&type=1&groupId=0`;
            xhs.navigateTo({
              url: path
            });
          }
          break;
        case '8': //商品
        case '10':
          {
            path = `/independentGoods/Goods/goods?goodsId=${id}&shareUserId=${userid}`;
            xhs.navigateTo({
              url: path
            });
          }
          break;
        case '9': //案例
        case '11':
        case '16':
          {
            path = `/pages/Employee/Material/caseDetail?id=${id}&shareUserId=${userid}`;
            xhs.navigateTo({
              url: path
            });
          }
          break;
        case '20':
          //卡券
          {
            // path = `${webViewUrl}coupon/manage/info/${id}&query=${webViewQuery}`;
            // wx.navigateTo({
            //   url: path,
            // })
          }
          break;
        case '18': //服务商品
        case '19':
          {
            path = `${webViewUrl}store/service/${id}&query=${webViewQuery}`;
            xhs.navigateTo({
              url: path
            });
          }
          break;
        case '12': //文章
        case '14':
          {
            path = `/pages/User/Article/info?id=${id}&shareUserId=${userid}`;
            xhs.navigateTo({
              url: path
            });
          }
          break;
        case '35': //砍价
        case '36':
          {
            path = `/independentBargain/Bargain/Detail/detail?bargainId=${id}&shareUserId=${userid}`;
            xhs.navigateTo({
              url: path
            });
          }
          break;
        case '7': //评选活动
        case '23':
          {
            path = `/pages/User/Choose/index?id=${id}&shareUserId=${userid}`;
            xhs.navigateTo({
              url: path
            });
          }
          break;
        case '38': //秒杀
        case '39':
          {
            path = `/independentKill/Kill/Detail/detail?id=${id}&shareUserId=${userid}`;
            xhs.navigateTo({
              url: path
            });
          }
          break;
        case '42': //集赞抽奖
        case '43':
          {
            path = `/pages/User/CollectFavour/Details/details?id=${id}&shareUserId=${userid}`;
            xhs.navigateTo({
              url: path
            });
          }
          break;
        case '40': //免费抽奖
        case '41':
        case '25': //参与抽奖活动
        case '26':
          {
            path = `/pages/User/luckDraw/Detail/detail?id=${id}&shareUserId=${userid}`;
            xhs.navigateTo({
              url: path
            });
          }
          break;
        case '44':
        case '45':
          {
            path = `/independentCrowdFunding/CrowdFunding/Detail/detail?id=${id}&shareUserId=${userid}`;
            xhs.navigateTo({
              url: path
            });
          }
          break;
        case '48':
          //浏览心愿
          xhs.navigateTo({
            url: `/independentWishAssist/WishAssist/Detail/detail?id=${id}&shareUserId=${userid}`
          });
          break;
        case '49':
          // 参与心愿
          xhs.navigateTo({
            url: `/independentWishAssist/WishAssist/Detail/detail?id=${id}&shareUserId=${userid}`
          });
          break;
        case '54':
          //浏览新商品
          {
            path = `/independentNewGoods/Goods/index?goodsId=${id}&shareUserId=${userid}`;
            xhs.navigateTo({
              url: path
            });
          }
          break;
        case '55':
          //购买新商品
          {
            path = `/independentNewGoods/Goods/index?goodsId=${id}&shareUserId=${userid}`;
            xhs.navigateTo({
              url: path
            });
          }
          break;
      }
    }
  }
});